Skip to content

Feature metadata serialization#305

Open
biqar wants to merge 51 commits into
hpc-io:developfrom
biqar:feature_metadata-serialization
Open

Feature metadata serialization#305
biqar wants to merge 51 commits into
hpc-io:developfrom
biqar:feature_metadata-serialization

Conversation

@biqar

@biqar biqar commented Mar 17, 2026

Copy link
Copy Markdown
Collaborator

Related Issues / Pull Requests

Related Issue: 282

Description

Integrate BULKI serializer for pdc server checkpointing.

What changes are proposed in this pull request?

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality not to work as expected; for instance, examples in this repository must be updated too)
  • This change requires a documentation update

Checklist:

  • My code modifies existing public API, or introduces new public API, and I updated or wrote docstrings
  • I have commented my code
  • My code requires documentation updates, and I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Added code to add kv-tags at scale. Also added code to get and verify tags at scale. The later test code will be used to verify the metadata checkpointing after a server restart.
…nd from file instead of using a buffer

Also added version control for the bulki-based checkpointing.
@biqar
biqar requested a review from a team as a code owner March 17, 2026 19:01
@biqar

biqar commented Mar 26, 2026

Copy link
Copy Markdown
Collaborator Author

Benchmark Summary (10000 objects, 100 tags)

Serial

Metric Previous New (BUKLI)
Close Time (s) 1.78 5.34
Restart Time (s) 2.09 0.21

Parallel (-N 1 -n 5 -c 2)

Metric Previous New (BUKLI)
Close Time (s) 0.85 0.45
Restart Time (s) 0.77 0.05

@biqar

biqar commented Mar 26, 2026

Copy link
Copy Markdown
Collaborator Author

@houjun and @jeanbez Please let me know the further steps to merge the PR.

@biqar biqar mentioned this pull request Mar 26, 2026
@houjun

houjun commented Mar 30, 2026

Copy link
Copy Markdown
Member

@biqar a couple of things:

  • Add your new checkpoint/restart test to run in cmake tests, the change in src/tests/CMakeLists.txt only compiles them
  • for benchmarking results, can you run with more variations in the number of obj/kvtag, and for each variation, run it at least 5 times and report the min, avg, and max?

@biqar

biqar commented Apr 2, 2026

Copy link
Copy Markdown
Collaborator Author

Todos:

  1. more rigorous testing
a. Strong scaling (fix the total amount of work and then change the number of workers)
Fix work to 100K/100 and then changing the number of parallel servers:
-n 2 -c 2
-n 4 -c 2
-n 8 -c 2
-n 16 -c 2

b. Weak scaling (fix the amount of workload per-worker)
10K/100 -n 2 -c 2 will implies in respect to checkpointing (10k + 10k*100) = 1010000
20K/100 -n 4 -c 2 will implies in respect to checkpointing (20k + 20k*100) = 2020000
40K/100 -n 8 -c 2 will implies in respect to checkpointing (40k + 40k*100) = 4040000
80K/100 -n 16 -c 2 will implies in respect to checkpointing (80k + 80k*100) = 8080000
  1. Add new checkpoint/restart test to run in cmake tests. Create a new version of run_checkpoint_restart_test.sh to accept the program parameters. Then add another version for mpi testing.

@biqar

biqar commented Apr 30, 2026

Copy link
Copy Markdown
Collaborator Author

Strong Scaling Performance Comparison

Fixed work to 100K objects and 100 tags creation and changing the number of parallel servers. Reporting min/max/avg of checkpoint time, server close time, and server restart time.

Checkpoint Time (seconds)

Servers Prev Min Prev Avg Prev Max New Min New Avg New Max
-n 2 -c 2 1.146857 1.208034 1.239199 359.340963 360.498139 361.789536
-n 4 -c 2 0.689133 0.706156 0.735507 62.639350 62.806907 63.095135
-n 8 -c 2 0.405211 0.406731 0.409733 11.268601 11.297985 11.330935
-n 16 -c 2 0.257778 0.266691 0.278840 3.188340 3.225553 3.251896

Server Close Time (seconds)

Servers Prev Min Prev Avg Prev Max New Min New Avg New Max
-n 2 -c 2 1.259604 1.315604 1.348103 359.350626 360.510299 361.805794
-n 4 -c 2 0.801891 0.823133 0.859166 62.651894 62.817672 63.105154
-n 8 -c 2 0.550356 0.558271 0.564412 11.284968 11.311051 11.347749
-n 16 -c 2 0.478174 0.488428 0.501940 3.202700 3.235686 3.258656

Server Restart Time (seconds)

Servers Prev Min Prev Avg Prev Max New Min New Avg New Max
-n 2 -c 2 0.265927 0.266252 0.266456 0.566464 0.594174 0.615873
-n 4 -c 2 0.137422 0.138248 0.139483 0.269829 0.283413 0.290344
-n 8 -c 2 0.070470 0.071441 0.072440 0.142268 0.144746 0.148689
-n 16 -c 2 0.040891 0.040909 0.040929 0.078482 0.079175 0.079950

Observations:

  1. Checkpoint creation time are dramatically higher with the BULKI serializer across all server counts, becoming roughly 300× slower at -n 2 and still ~12× slower at -n 16. This is a significant degradation.
  2. Restart times show a more modest degradation, roughly 2× slower across all configurations in the new BULKI deserializer.
  3. Both versions show good strong scaling behavior (times decrease as server count increases), but the BULKI's absolute times are far higher.

Weak Scaling Performance Comparison

Fixed the amount of workload per-worker. Reporting min/max/avg of checkpoint time, server close time, and server restart time.

Checkpoint Time (seconds)

Servers (Workload) Prev Min Prev Avg Prev Max New Min New Avg New Max
-n 2 -c 2 (10K/100) 0.155281 0.159597 0.162538 1.807282 1.835119 1.886592
-n 4 -c 2 (20K/100) 0.164595 0.166748 0.170526 1.813283 1.828611 1.848121
-n 8 -c 2 (40K/100) 0.183058 0.185744 0.188479 1.818360 1.830279 1.846697
-n 16 -c 2 (80K/100) 0.209380 0.217758 0.228390 2.080548 2.100604 2.138375

Close Time (seconds)

Servers (Workload) Prev Min Prev Avg Prev Max New Min New Avg New Max
-n 2 -c 2 (10K/100) 0.259814 0.263879 0.267591 1.812648 1.844281 1.902948
-n 4 -c 2 (20K/100) 0.283108 0.285033 0.286081 1.820875 1.835485 1.853913
-n 8 -c 2 (40K/100) 0.329559 0.337133 0.342381 1.825027 1.840674 1.857495
-n 16 -c 2 (80K/100) 0.434089 0.443785 0.450590 2.092237 2.114594 2.151783

Restart Time (seconds)

Servers (Workload) Prev Min Prev Avg Prev Max New Min New Avg New Max
-n 2 -c 2 (10K/100) 0.029562 0.030135 0.030464 0.059689 0.059926 0.060158
-n 4 -c 2 (20K/100) 0.029578 0.030246 0.030927 0.056596 0.057787 0.059115
-n 8 -c 2 (40K/100) 0.029415 0.030096 0.030845 0.056701 0.057546 0.058305
-n 16 -c 2 (80K/100) 0.032854 0.033069 0.033227 0.064084 0.065558 0.066550

Observations

  1. BULKI's checkpoint creation times are about ~11× slower.
  2. Both versions shows excellent weak scaling (fairly flat across n2–n8, with a slight uptick at n16).
  3. Restart times degrades by roughly 2×.

Issue: Unexpected Checkpoint Overhead After Restart with BULKI Serializer

Description

The BULKI Serializer integration introduces unexpected performance overhead in the second checkpoint cycle. Since no new data is added after the restart, both checkpoint times should be roughly equivalent. However, we observe a consistent 29–52% increase in the second checkpoint time compared to the first.

Workflow

  1. Start server and create 100K objects with 100 tags each
  2. Stop the server → record 1st checkpoint time
  3. Restart the server
  4. Read and verify all objects/tags
  5. Stop the server → record 2nd checkpoint time

Expected Behavior

Since no new data is added after the restart, the 1st and 2nd checkpoint times should be approximately equal (as showing in the existing binary serializer based checkpoint time comparison bellow).

Observed Behavior

The 2nd checkpoint time is consistently 29–52% more expensive than the 1st under the BULKI Serializer.

BULKI Serializer: Checkpoint Time Comparison (seconds)

Servers 1st Checkpoint (Avg) 2nd Checkpoint (Avg) Overhead (%)
-n 2 -c 2 360.498139 549.173542 +52.34%
-n 4 -c 2 62.806907 81.879827 +30.37%
-n 8 -c 2 11.297985 15.036968 +33.09%
-n 16 -c 2 3.225553 4.169183 +29.26%

Binary Serializer: Checkpoint Time Comparison (seconds)

Servers 1st Checkpoint (Avg) 2nd Checkpoint (Avg) Overhead (%)
-n 2 -c 2 1.208034 1.423412 +17.83%
-n 4 -c 2 0.706156 0.695221 -1.55%
-n 8 -c 2 0.406731 0.410047 +0.82%
-n 16 -c 2 0.266691 0.274068 +2.77%

@TheAssembler1

Copy link
Copy Markdown
Collaborator

@biqar could you time each BULKI operation so we can see what's taking so long on the strong scaling? For instance if the BULKI_ENTITY_append_BULKI operation is taking a long time we can look at preallocating the array with a known capacity rather than starting from empty_BULKI_Array_Entity and expanding on every append.

@jeanbez jeanbez added the type: enhancement New feature or request label May 15, 2026
@biqar

biqar commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator Author

Strong Scaling Performance Comparison

Fixed work to 100K objects and 100 tags creation and changing the number of parallel servers. Reporting min/max/avg of server close time, and server restart time.

Server Close Time (seconds)

Servers Prev Min Prev Avg Prev Max New Min New Avg New Max
-n 2 -c 2 1.26 1.32 1.35 1.14 1.25 1.31
-n 4 -c 2 0.80 0.82 0.86 0.68 0.73 0.77
-n 8 -c 2 0.55 0.56 0.56 0.52 0.58 0.68
-n 16 -c 2 0.48 0.49 0.50 0.50 0.51 0.52

Server Restart Time (seconds)

Servers Prev Min Prev Avg Prev Max New Min New Avg New Max
-n 2 -c 2 0.27 0.27 0.27 0.58 0.58 0.58
-n 4 -c 2 0.14 0.14 0.14 0.28 0.29 0.31
-n 8 -c 2 0.07 0.07 0.07 0.15 0.15 0.16
-n 16 -c 2 0.04 0.04 0.04 0.08 0.08 0.08

Weak Scaling Performance Comparison

Fixed the amount of workload per-worker. Reporting min/max/avg of server close time, and server restart time.

Close Time (seconds)

Servers (Workload) Prev Min Prev Avg Prev Max New Min New Avg New Max
-n 2 -c 2 (10K/100) 0.259814 0.263879 0.267591 0.251280 0.268680 0.285370
-n 4 -c 2 (20K/100) 0.283108 0.285033 0.286081 0.285235 0.306253 0.330713
-n 8 -c 2 (40K/100) 0.329559 0.337133 0.342381 0.354895 0.371476 0.398834
-n 16 -c 2 (80K/100) 0.434089 0.443785 0.450590 0.429344 0.449732 0.469307

Restart Time (seconds)

Servers (Workload) Prev Min Prev Avg Prev Max New Min New Avg New Max
-n 2 -c 2 (10K/100) 0.029562 0.030135 0.030464 0.059596 0.059888 0.060071
-n 4 -c 2 (20K/100) 0.029578 0.030246 0.030927 0.057397 0.059212 0.061619
-n 8 -c 2 (40K/100) 0.029415 0.030096 0.030845 0.057844 0.058478 0.059103
-n 16 -c 2 (80K/100) 0.032854 0.033069 0.033227 0.066718 0.067521 0.068555

Issue: Unexpected Checkpoint Overhead After Restart with BULKI Serializer

Description

The BULKI Serializer integration previously observed an unexpected performance overhead in the second checkpoint cycle. Since no new data is added after the restart, both checkpoint times should be roughly equivalent. However, we previously observe a consistent 29–52% increase in the second checkpoint time compared to the first. The new fix in avoiding recursive size computation have fixed the issue.

Workflow

  1. Start server and create 100K objects with 100 tags each
  2. Stop the server → record 1st checkpoint time
  3. Restart the server
  4. Read and verify all objects/tags
  5. Stop the server → record 2nd checkpoint time

Expected Behavior

Since no new data is added after the restart, the 1st and 2nd checkpoint times should be approximately equal.

Observed Behavior

The BULKI Serializer show similar trend as the old binary serializer.

BULKI Serializer: Server Close Time Comparison (seconds)

Servers 1st Server Close (Avg) 2nd Server Close (Avg) Overhead (%)
-n 2 -c 2 1.251261 1.391698 +11.22%
-n 4 -c 2 0.726320 0.806436 +11.03%
-n 8 -c 2 0.580509 0.540463 -6.90%
-n 16 -c 2 0.508104 0.489826 -3.60%

Binary Serializer: Checkpoint Time Comparison (seconds)

Servers 1st Checkpoint (Avg) 2nd Checkpoint (Avg) Overhead (%)
-n 2 -c 2 1.208034 1.423412 +17.83%
-n 4 -c 2 0.706156 0.695221 -1.55%
-n 8 -c 2 0.406731 0.410047 +0.82%
-n 16 -c 2 0.266691 0.274068 +2.77%

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR integrates BULKI-based serialization into the PDC server checkpoint/restart path to persist and restore in-memory metadata (including transfer-request query state), and adds new scale-style kvtag tests plus checkpoint/restart test runners to validate the behavior.

Changes:

  • Switch server checkpoint/restart from raw fwrite/fread blobs to a BULKI-serialized checkpoint tree (containers, metadata, regions, transfer-query state).
  • Extend BULKI with incremental size/accounting + preallocated array helpers and add corresponding serde tests.
  • Add kvtag add/verify scale tests and new checkpoint/restart runners (serial + MPI) wired into CTest.

Reviewed changes

Copilot reviewed 12 out of 13 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
src/server/pdc_server.c Reworks checkpoint/restart implementation to build/parse a BULKI checkpoint tree and initializes transfer-query restore via BULKI.
src/server/pdc_server_region/pdc_server_region_transfer_metadata_query.c Adds BULKI-based init/checkpoint support for transfer metadata query state.
src/server/pdc_server_region/include/pdc_server_region_transfer_metadata_query.h Exposes new BULKI-based init/checkpoint APIs.
src/commons/serde/bulki/include/bulki.h Adds capacity + incremental append/put/delete APIs for efficient bulk construction.
src/commons/serde/bulki/bulki.c Implements incremental APIs, array capacity handling, and cached-size updates.
src/commons/serde/bulki/bulki_serde.c Adds notes around redundant tree walks and buffer-then-fwrite serialization behavior.
src/commons/serde/bulki/bulki_serde_test.c Adds tests validating incremental size accounting and round-trip correctness.
src/tests/tags/kvtag_add_scale.c New scale test for creating many objects and adding tags (used in checkpoint/restart tests).
src/tests/tags/kvtag_get_verify_scale.c New scale test for reading/verifying tags across many objects (used in checkpoint/restart tests).
src/tests/run_checkpoint_restart_test_with_prog_param.sh New serial checkpoint/restart runner that accepts program+args strings.
src/tests/run_checkpoint_restart_mpi_test_with_prog_param.sh New MPI checkpoint/restart runner that accepts program+args strings.
src/tests/CMakeLists.txt Registers new executables/scripts and adds serial + MPI checkpoint/restart tests.
src/api/close_server.c Minor formatting/whitespace change.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/commons/serde/bulki/bulki.c
Comment thread src/server/pdc_server.c
Comment thread src/server/pdc_server.c
Comment on lines +81 to +104
#ifdef ENABLE_MPI
MPI_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, &proc_num);
MPI_Comm_rank(MPI_COMM_WORLD, &my_rank);
#endif
if (argc < 3) {
if (my_rank == 0)
print_usage(argv[0]);
PGOTO_DONE(FAIL);
}
n_obj = atoi(argv[1]);
n_add_tag = atoi(argv[2]);

if (n_add_tag > n_obj) {
if (my_rank == 0)
LOG_ERROR("n_add_tag larger than n_obj! Exiting...\n");
PGOTO_DONE(FAIL);
}

assign_work_to_rank(my_rank, proc_num, n_add_tag, &my_add_tag, &my_add_tag_s);
assign_work_to_rank(my_rank, proc_num, n_obj, &my_obj, &my_obj_s);

obj_1percent = my_obj / 100;
tag_1percent = my_add_tag / 100;
Comment thread src/tests/tags/kvtag_add_scale.c Outdated
Comment on lines +141 to +142
if (i > 0 && i % obj_1percent == 0) {
#ifdef ENABLE_MPI
Comment thread src/tests/tags/kvtag_add_scale.c Outdated
Comment on lines +180 to +187
if (i % tag_1percent == 0) {
#ifdef ENABLE_MPI
MPI_Barrier(MPI_COMM_WORLD);
percent_time = MPI_Wtime() - stime;
if (my_rank == 0) {
int current_percentage = i / tag_1percent;
int estimated_current_tag_number = n_obj / 100 * current_percentage;
double tps = estimated_current_tag_number / percent_time;
Comment on lines +89 to +111
#ifdef ENABLE_MPI
MPI_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, &proc_num);
MPI_Comm_rank(MPI_COMM_WORLD, &my_rank);
#endif
if (argc < 3) {
if (my_rank == 0)
print_usage(argv[0]);
PGOTO_DONE(FAIL);
}
n_obj = atoi(argv[1]);
n_query = atoi(argv[2]);

if (n_query > n_obj) {
if (my_rank == 0)
LOG_ERROR("n_query larger than n_obj! Exiting...\n");
PGOTO_DONE(FAIL);
}

assign_work_to_rank(my_rank, proc_num, n_query, &n_tag, &n_tag_s);
assign_work_to_rank(my_rank, proc_num, n_obj, &my_obj, &my_obj_s);

obj_1percent = my_obj / 100;
Comment on lines +97 to +104
BULKI_Entity *ndim_ent = BULKI_get(obj_bulki, BULKI_singleton_ENTITY("ndim", PDC_STRING));
if (ndim_ent == NULL) {
LOG_ERROR("Missing ndim in checkpoint object\n");
PDC_free(obj_pkg);
continue;
}
memcpy(&obj_pkg->ndim, ndim_ent->data, sizeof(int));

Comment on lines +135 to +146
BULKI_Entity *offset_size_ent =
BULKI_get(region_bulki, BULKI_singleton_ENTITY("reg_offset_size", PDC_STRING));
if (offset_size_ent != NULL) {
memcpy(region_pkg->reg_offset, offset_size_ent->data,
sizeof(uint64_t) * obj_pkg->ndim * 2);
}
else {
LOG_ERROR("Missing reg_offset_size in checkpoint region\n");
PDC_free(region_pkg->reg_offset);
PDC_free(region_pkg);
continue;
}
@biqar
biqar requested review from TheAssembler1 and houjun July 2, 2026 21:19
biqar and others added 12 commits July 3, 2026 11:17
Add null checks after every required BULKI_get() call in PDC_Server_restart() so malformed or incomplete checkpoint files fail with a clear error instead of dereferencing a null entity pointer.
…into feature_metadata-serialization

# Conflicts:
#	src/server/pdc_server.c
When removing the last remaining key, the function decremented numKeys and then always copied from index numKeys - 1. With numKeys equal to 0, that index underflows and can corrupt memory or crash. Skip the swap when the deleted key is already at the last index. Also reject NULL bulki or key arguments at entry.
Derive per-rank tag add/query work from each rank's object partition so object indices and tag values stay aligned when n_tag != n_obj. Initialize proc_num and my_rank in serial builds, guard progress reporting against division by zero when per-rank work is under 100, and base tag/query TPS estimates on n_add_tag/n_query instead of n_obj.
Reject ndim outside [1, DIM_MAX] before allocating region buffers, and fail restore on missing or mismatched reg_offset_size so malformed checkpoints cannot trigger oversized allocations or memcpy overflows.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 14 changed files in this pull request and generated 17 comments.

Comment thread src/commons/serde/bulki/bulki.c Outdated
Comment on lines +667 to +686
BULKI_Entity *value = NULL;
size_t last_index = bulki->numKeys - 1;
for (size_t i = 0; i < bulki->numKeys; i++) {
if (BULKI_Entity_equal(&bulki->header->keys[i], key)) {
value = &bulki->data->values[i];
bulki->header->headerSize -= key->size;
bulki->data->dataSize -= value->size;
bulki->numKeys--;
if (i != last_index) {
memcpy(&bulki->header->keys[i], &bulki->header->keys[bulki->numKeys - 1],
sizeof(BULKI_Entity));
memcpy(&bulki->data->values[i], &bulki->data->values[bulki->numKeys - 1],
sizeof(BULKI_Entity));
}
break;
}
}
bulki_refresh_total_size(bulki);

FUNC_LEAVE(value);
Comment thread src/server/pdc_server.c
Comment on lines +1856 to +1865
BULKI_Entity *range_ent =
BULKI_get(histogram, BULKI_singleton_ENTITY("range", PDC_STRING));
region_list->region_hist->range =
(double *)PDC_malloc(sizeof(double) * (size_t)nbin * 2);
if (range_ent == NULL || range_ent->data == NULL)
PGOTO_ERROR(FAIL, "Missing histogram range in checkpoint");
region_list->region_hist->range =
(double *)PDC_malloc(sizeof(double) * (size_t)nbin * 2);
memcpy(region_list->region_hist->range, range_ent->data,
sizeof(double) * (size_t)nbin * 2);
Comment thread src/server/pdc_server.c
Comment on lines +1867 to +1876
BULKI_Entity *bin_ent =
BULKI_get(histogram, BULKI_singleton_ENTITY("bin", PDC_STRING));
region_list->region_hist->bin =
(uint64_t *)PDC_malloc(sizeof(uint64_t) * (size_t)nbin);
if (bin_ent == NULL || bin_ent->data == NULL)
PGOTO_ERROR(FAIL, "Missing histogram bin in checkpoint");
region_list->region_hist->bin =
(uint64_t *)PDC_malloc(sizeof(uint64_t) * (size_t)nbin);
memcpy(region_list->region_hist->bin, bin_ent->data,
sizeof(uint64_t) * (size_t)nbin);
Comment thread src/server/pdc_server.c
Comment on lines +1964 to +1968
// extract obj_id
BULKI_Entity *obj_id_ent =
BULKI_get(dataserver_obj, BULKI_singleton_ENTITY("obj_id", PDC_STRING));
memcpy(&new_obj_reg->obj_id, obj_id_ent->data, sizeof(uint64_t));

Comment thread src/server/pdc_server.c
Comment on lines +1984 to +1987
BULKI_Entity *region_ent =
BULKI_get(ds_region, BULKI_singleton_ENTITY("region", PDC_STRING));
memcpy(region_list, region_ent->data, sizeof(region_list_t));

Comment on lines +256 to +259
// set return value based on verification results
if (verified_fail > 0) {
ret_value = FAIL;
}
Comment on lines +152 to +155
#ifdef ENABLE_MPI
MPI_Barrier(MPI_COMM_WORLD);
stime = MPI_Wtime();
#endif
Comment on lines +178 to +185
#ifdef ENABLE_MPI
MPI_Barrier(MPI_COMM_WORLD);
total_time = MPI_Wtime() - stime;
#endif

if (my_rank == 0)
LOG_INFO("Total time to create %11d objects: %7.2f , throughput %10.2f \n", n_obj, total_time,
n_obj / total_time);
Comment thread src/server/pdc_server.c
Comment on lines +1287 to 1299
BULKI *container_entry = BULKI_init(2);

hash_key = PDC_get_hash_by_name(cont_head->cont_name);
fwrite(&hash_key, sizeof(uint32_t), 1, file);
fwrite(cont_head, sizeof(pdc_cont_hash_table_entry_t), 1, file);
BULKI_put_incremental(container_entry, BULKI_singleton_ENTITY("hash_key", PDC_STRING),
BULKI_ENTITY(&hash_key, 1, PDC_UINT32, PDC_CLS_ITEM));

// store the container structure as binary blob
BULKI_put_incremental(
container_entry, BULKI_singleton_ENTITY("cont_data", PDC_STRING),
BULKI_ENTITY(cont_head, sizeof(pdc_cont_hash_table_entry_t), PDC_UINT8, PDC_CLS_ARRAY));

BULKI_ENTITY_append_BULKI_incremental(containers_array, container_entry);
}
Comment on lines +368 to +387
region_temp = obj_temp->regions;
while (region_temp) {
BULKI *region_bulki = BULKI_init(2);

BULKI_put_incremental(region_bulki, BULKI_singleton_ENTITY("data_server_id", PDC_STRING),
BULKI_ENTITY(&region_temp->data_server_id, 1, PDC_UINT32, PDC_CLS_ITEM));

BULKI_put_incremental(
region_bulki, BULKI_singleton_ENTITY("reg_offset_size", PDC_STRING),
BULKI_ENTITY(region_temp->reg_offset, obj_temp->ndim * 2, PDC_UINT64, PDC_CLS_ARRAY));

BULKI_ENTITY_append_BULKI_incremental(regions_array, region_bulki);
region_temp = region_temp->next;
}

BULKI_put_incremental(obj_bulki, BULKI_singleton_ENTITY("regions", PDC_STRING), regions_array);

BULKI_ENTITY_append_BULKI_incremental(objects_array, obj_bulki);

obj_temp = obj_temp->next;

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 14 changed files in this pull request and generated 9 comments.

Comment thread src/server/pdc_server.c
Comment on lines +1819 to +1823
if (region_ent == NULL || region_ent->data == NULL)
PGOTO_ERROR(FAIL, "Missing region in checkpoint");
memcpy(region_list, region_ent->data, sizeof(region_list_t));

// extract histogram flag
Comment thread src/server/pdc_server.c
Comment on lines +1985 to +1989
if (region_ent == NULL || region_ent->data == NULL)
PGOTO_ERROR(FAIL, "Missing/invalid dataserver region blob in checkpoint");
memcpy(region_list, region_ent->data, sizeof(region_list_t));

// initialize fields (similar to above)
Comment thread src/server/pdc_server.c
Comment on lines +1803 to +1807
int n_region = 0;
if (regions_array != NULL && regions_array->pdc_type == PDC_BULKI) {
n_region = regions_array->count;
if (n_region < 0 || n_region > PDC_CHECKPOINT_MAX_REGION_COUNT)
PGOTO_ERROR(FAIL, "Suspicious n_region value %d from checkpoint", n_region);
Comment thread src/server/pdc_server.c
BULKI_Entity *metadata_objs_array =
BULKI_get(hash_entry, BULKI_singleton_ENTITY("metadata_objects", PDC_STRING));

if (metadata_objs_array != NULL && metadata_objs_array->pdc_type == PDC_BULKI) {
Comment thread src/server/pdc_server.c
Comment on lines +1298 to 1299
BULKI_ENTITY_append_BULKI_incremental(containers_array, container_entry);
}
Comment on lines +379 to +381
BULKI_ENTITY_append_BULKI_incremental(regions_array, region_bulki);
region_temp = region_temp->next;
}
Comment on lines +385 to +387
BULKI_ENTITY_append_BULKI_incremental(objects_array, obj_bulki);

obj_temp = obj_temp->next;
Comment on lines +607 to +615
if (existing_value != NULL) {
bulki->header->headerSize -= key->size;
bulki->data->dataSize -= existing_value->size;
memcpy(existing_value, value, sizeof(BULKI_Entity));
bulki->header->headerSize += key->size;
bulki->data->dataSize += value->size;
bulki_refresh_total_size(bulki);
FUNC_LEAVE_VOID();
}
Comment on lines 877 to 880
else if (bulk_entity->pdc_class == PDC_CLS_ITEM) {
if (bulk_entity->pdc_type == PDC_BULKI && bulk_entity->data != NULL) {
BULKI_free((BULKI *)bulk_entity->data, 0);
bulk_entity->data = NULL;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants